{
LANG : PASCAL
PROB : buylow
}

program BUYLOW;
const
  fi = 'buylow.in';
  fo = 'buylow.out';
  max = 500;
var
  a, b, ID : array[1..max] of longint;
  c, d, pre : array[1..max] of longint;
  n, maxc, sumd : longint;

procedure inp;
var
  i : longint;
begin
  read(n);
  for i := 1 to n do
  begin
    read(a[i]);
    b[i] := a[i];
    ID[i] := i;
  end;
end;

procedure swap(i, j : integer);
var
  temp : longint;
begin
  temp := ID[i];
  ID[i] := ID[j];
  ID[j] := temp;
  temp := b[i];
  b[i] := b[j];
  b[j] := temp;
end;

procedure sort(l, r : longint);
var
  i, j, k : longint;
begin
  if l >= r then exit;
  i := l;
  j := r;
  k := b[l+random(r-l+1)];
  repeat
    while b[i] < k do inc(i);
    while b[j] > k do dec(j);
    if i <= j then
    begin
      swap(i, j);
      inc(i); dec(j);
    end;
  until i > j;
  sort(i, r); sort(l, j);
end;

procedure init;
var
  i, v, count : integer;
begin
  sort(1, n);
  v := -1;
  count := 0;
  for i := 1 to n do
    if b[i] > v then
    begin
      inc(count);
      a[ID[i]] := count;
      v := b[i];
    end
    else a[ID[i]] := count;
end;

procedure process;
var
  i, j : integer;
begin
  for i := 1 to n do
  begin
    pre[i] := 0;
    for j := i-1 downto 1 do
      if a[j] = a[i] then
      begin
        pre[i] := j;
        break;
      end;
  end;
  for i := 1 to n do
  begin
    c[i] := 1;
    d[i] := 1;
    for j := pre[i]+1 to i-1 do
      if a[j] > a[i] then
        if c[i] < c[j]+1 then
        begin
          c[i] := c[j]+1;
          d[i] := d[j];
        end
        else
          if c[i] = c[j]+1 then inc(d[i], d[j]);
  end;
end;

procedure out;
var
  i, j : integer;
begin
  maxc := -1;
  sumd := 0;
  for i := 1 to n do
    if maxc < c[i] then
    begin
      maxc := c[i];
      sumd := d[i];
    end
    else
      if maxc = c[i] then inc(sumd, d[i]);
  writeln(maxc, ' ', sumd);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);

  inp;
  process;
  out;

  close(output);
  close(input);
end.
